package com.huike.web.controller.report;


import com.huike.report.domain.vo.TodayInfoVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }


    //@GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo1(){

        int TodayClueNum= reportService.getTodayClueNum();
        //int todayBusinessNum= reportService.getTodayClueNum();
        //int todayContractNum= reportService.getTodayClueNum();
        //double todaySalesAmount= reportService.getTodayClueNum();

        TodayInfoVo todayInfoVo = new TodayInfoVo();
        todayInfoVo.setTodayCluesNum(TodayClueNum);

        return AjaxResult.success(todayInfoVo);
    }

    /**
     *
     *今日简报
     * @return
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){








        return AjaxResult.success(reportService.getTodayInfo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())));
    }

    /**
     * 代办事项
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getTodoInfo(beginCreateTime,endCreateTime));
    }


    /**
     * 线索统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
   /* @GetMapping("/cluesStatistics/{beginCreateTime}/{endCreateTime}")
    public LineChartVo cluesStatistics(@PathVariable String beginCreateTime, @PathVariable String endCreateTime){
        return reportService.cluesStatistics(beginCreateTime,endCreateTime);
    }*/



     /**
     * 学科分布统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
   /* @GetMapping("/subjectStatistics/{beginCreateTime}/{endCreateTime}")
    public AjaxResult subjectStatistics(@PathVariable String beginCreateTime, @PathVariable String endCreateTime){
        return AjaxResult.success(reportService.subjectStatistics(beginCreateTime,endCreateTime));
    }*/


}